# -*- coding:UTF-8 -*-
"""
@Project : pythonProject
@File    : Python06-deepseek.py
@IDE     : PyCharm
@Author  : WorldWind(1772830365@qq.com)
@Address : China - HeiLongjiang - Herbin
@Date    : 2025/7/8 上午12:00
"""

def merge_dicts(dict1, dict2):
    merged = {}
    for key, value in dict1.items():
        if key in merged:
            merged[key] += value
        else:
            merged[key] = value

    for key, value in dict2.items():
        if key in merged:
            merged[key] += value
        else:
            merged[key] = value

    return merged


# 示例调用
dict1 = {"a": 1, "b": 2, "c": 3}
dict2 = {"c": 3, "d": 4}

result = merge_dicts(dict1, dict2)
print(result)  # 输出: {'a': 1, 'b': 2, 'c': 3, 'd': 4}
